#include "led.h"
#include "key.h"
#include "delay.h"
#include "usart.h"
#include <stdio.h>
#include "tim5.h"
#include "tim4.h"

int main(void)
{
    // 初始化
    USART_Init();
    TIM5_Init();
    TIM4_Init();

    printf("general timer program start\n");

    // 开启定时器
    TIM5_Start();
    TIM4_Start();

    TIM5_SetDutyCycle(78);

    while(1)
    {
        printf("T = %.2fms, f = %.2f Hz, duty = %.2f %%  %d\n",
            TIM4_GetPWMCycle(), TIM4_GetPWMFreq(), TIM4_GetPWMDutyCycle() * 100, TIM4_getCCR());
        // 延迟1000ms
        Delay_ms(1000);
    }
}
